import requests

from api.Tpshop_register import TpshopRegiser
from common.assert_tpshop_tools import common_assert1


class TestTpshop(object):
    def setup_class(self):
        self.tpshop = TpshopRegiser()

    def test01_register_success(self):
        req_body = {"username": "15003467036", "verify_code": "8888",
                    "password": "123456", "password2": "123456"}
        resp = self.tpshop.regiser(req_body)
        print("注册成功：", resp.json())
        common_assert1(resp, 200, "注册成功")

    def test02_register_success(self):
        req_body = {"username": "15003469099", "verify_code": "8888",
                    "password": "123456", "password2": "123456"}
        resp = self.tpshop.regiser(req_body)
        print("该手机号已注册：", resp.json())
        common_assert1(resp, 200, "该手机号已注册")

    def test03_register_success(self):
        req_body = {"username": "15003466036", "verify_code": "8888",
                    "password": "123456", "password2": "12345"}
        resp = self.tpshop.regiser(req_body)
        print("两次密码不一致：", resp.json())
        common_assert1(resp, 200, "两次密码不一致")

    # 5. 打印登录结果
    # print("注册：", resp.json())
    #
    # assert 200 == resp.status_code
    # assert "注册成功" in resp.json().get("msg")
